let mut url = url.clone();
// Strip a trailing slash
- if url.path().ends_with("/") {
+ if url.path().ends_with('/') {
url.path_segments_mut().unwrap().pop_if_empty();
}
let dir = try!(dir).path();
let name = dir.file_name().and_then(|s| s.to_str());
// Skip dotfile directories
- if name.map(|s| s.starts_with(".")) == Some(true) {
+ if name.map(|s| s.starts_with('.')) == Some(true) {
continue
} else if is_root {
// Skip cargo artifacts
summaries.retain(|s| {
match self.source_id.precise() {
Some(p) if p.starts_with(dep.name()) &&
- p[dep.name().len()..].starts_with("=") => {
+ p[dep.name().len()..].starts_with('=') => {
let vers = &p[dep.name().len() + 1..];
s.version().to_string() == vers
}
pub fn get_path(&self, key: &str) -> CargoResult<Option<Value<PathBuf>>> {
if let Some(val) = try!(self.get_string(&key)) {
- let is_path = val.val.contains("/") ||
- (cfg!(windows) && val.val.contains("\\"));
+ let is_path = val.val.contains('/') ||
+ (cfg!(windows) && val.val.contains('\\'));
let path = if is_path {
val.definition.root(self).join(val.val)
} else {
// even valid UTF-8. Here we just ignore all of them and require
// that they are explicitly specified in Cargo.toml if desired.
f.file_name().and_then(|s| s.to_str()).map(|s| {
- !s.starts_with(".")
+ !s.starts_with('.')
}).unwrap_or(true)
}))
}
Some(ref name) => {
if name.trim().is_empty() {
Err(human("library target names cannot be empty.".to_string()))
- } else if name.contains("-") {
+ } else if name.contains('-') {
Err(human(format!("library target names cannot contain hyphens: {}",
name)))
} else {